
$(function() {
	$("input[id^='userfile']:visible").uploadify({
		'uploader'       : '/js/uploadify.swf',
		'cancelImg'      : '/images/uploadify/cancel.png',
		'buttonImg'      : '/images/uploadify/browse-files.png',
		'width'          : 130,
		'queueSizeLimit' : 1,
		'multi'          : true, 
		
		'onAllComplete'  : function(event, data) {
			$("form[id^='form_add']:visible").dialog("close");
		}
	});
	
	$("input[id^='button_send']:visible").click(function() {
		// alert(this.name);
		post_send(this.form);
	});
});

function post_send(form) {
	// alert("222");
	var to = form.to.value;
	if (is_null(to)) {
		alert("传真号码不能为空！");
		return false;
	}
	
	var queryString = $("form[id^='form_add']:visible").formSerialize(); 
	// alert(queryString);
	
	var s = "fax.php?do=Fax.ajax_upload&" + queryString;
	$("#sendfile").uploadifySettings('script', s);
	$("#sendfile").uploadifyUpload();
	
	alert("发送成功！");
}
